package com.qcby.model.dto;

import com.qcby.util.StringUtils;
import com.qcby.util.TimeUtils;
import lombok.*;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ScreeningOrganizeQueryDto {

    private Integer cid;

    private Integer hid;

    private Integer mid;

    private String day;// YYYYMMDD

    private Integer pageNo;

    private Integer pageSize;

    public void isParamValid() {
        if (this.mid == null) {
            throw new IllegalArgumentException("电影id为空！");
        }
        if (this.pageSize == null || this.pageSize == 0) {
            throw new IllegalArgumentException("每页数量不能为空或0！");
        }
        if (!StringUtils.isEmpty(day)) {
            if (!TimeUtils.isDateFormatValid("yyyyMMdd", this.day)) {
                throw new IllegalArgumentException("日期不符合yyyyMMdd格式要求！");
            }
        }
    }

}
